import uiautomation as auto

from game import zz_game
from zz import zz_log, zz_img_cv, zz_str

log = zz_log.of()


# 图片匹配查看

def save_img():
    window = auto.PaneControl(searchDepth=1, ClassName='地下城与勇士')  # search 2 times
    # window.SetTopmost(True)
    window.Click()

    img_path = zz_game.get_pc_temp_file()
    window.CaptureToImage(img_path)


if __name__ == '__main__':
    src_path = zz_game.get_pc_temp_file()
    src_path = ''
    # src_path = './../_tmp/game_next_test.png'
    if zz_str.is_null_or_empty(src_path):
        save_img()
        src_path = zz_game.get_pc_temp_file()

    target_path = 'game/img/player.png'  # 例子
    target_path = 'game/img/player_01.png'
    # target_path = 'game/img/next.png'
    target_path = './game/img/play_done.png'
    target_path = './game/img/play_location.png'

    zz_img_cv.find_img_rectangle_show(src_path, target_path, 0.9)
